﻿<include file="Public:_head" />
<style>.red{border-color:red;}
#GS_Introduction .form dl dd .text_red {
padding: 0 12px;
width: 432px;
line-height: 44px;
height: 44px;
font-size: 14px;
font-family: '微软雅黑';
border: 1px solid red;
}</style>
<script>
function check(){
	if($("input[name='company_name']").attr('value')==""){
		$("input[name='company_name']").addClass('text_red');
		$("input[name='company_name']").removeClass('text');
		return false;
	}else{
		$("input[name='company_name']").addClass('text');
		$("input[name='company_name']").removeClass('text_red');
	}
	if($("select[name='hangye']").attr('value')==""){
		$("select[name='hangye']").addClass('red');
		return false;
	}else{
		$("select[name='hangye']").removeClass('red');
	}
	if($("input[name='contact']").attr('value')==""){
		$("input[name='contact']").addClass('text_red');
		$("input[name='contact']").removeClass('text');
		return false;
	}else{
		$("input[name='contact']").addClass('text');
		$("input[name='contact']").removeClass('text_red');
	}
	if($("input[name='call']").attr('value')==""){
		$("input[name='call']").addClass('text_red');
		$("input[name='call']").removeClass('text');
		return false;
	}else{
		$("input[name='call']").addClass('text');
		$("input[name='call']").removeClass('text_red');
	}
	
	if($("select[name='city']").attr('value')=="0"){
		$("select[name='city']").addClass('red');
		return false;
	}else{
		$("select[name='city']").removeClass('red');
	}
	if($("select[name='area']").attr('value')=="0"){
		$("select[name='area']").addClass('red');
		return false;
	}else{
		$("select[name='area']").removeClass('red');
	}
	if($("input[name='address']").attr('value')==""){
		$("input[name='address']").addClass('text_red');
		$("input[name='address']").removeClass('text');
		return false;
	}else{
		$("input[name='address']").addClass('text');
		$("input[name='address']").removeClass('text_red');
	}
}
</script>
				<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>
				<script type="text/javascript" charset="utf-8" src="com_statics/ueditor/ueditor.config.js"></script>
				<script type="text/javascript" charset="utf-8" src="com_statics/ueditor/ueditor.all.min.js"> </script>
                <div id="GS_Introduction">
                    <ol class="Step">
                        <li class="change">① 填写资料</li>
                        <li>② 提交完成</li>
                    </ol>
                    <span class="clear"></span>
                    <h2>商户基本信息</h2>
                    <form action="{:U('Setting/saveinfo',array('cid'=>$cid))}" class="form" method="post" onSubmit="return check();"><dl>
                        <dt>企业名称<font color="red">*</font>：</dt>
                        <dd><input type="text" class="text" name="company_name" value="{$company.company_name}" /></dd>
                        <dt>所在行业<font color="red">*</font>：</dt>
                        <dd>
							<select name="hangye">
								<volist name="hangye" id="h">
								<option value="{$h.id}" <if condition="$h.id eq $company['hangye']">selected</if>>{$h.h_name}</option>
								</volist>
							</select>
						</dd>
                        <dt>联  系  人<font color="red">*</font>：</dt>
                        <dd><input type="text" class="text" name="contact" value="{$company.contact}" /></dd>
                        <dt>联系电话<font color="red">*</font>：</dt>
                        <dd><input type="text" class="text" name="call" value="{$company.call}" /></dd>
                        
                        <dt>公司地址<font color="red">*</font>：</dt>
                        <dd>
							<select name="pro" class="s-text-select pro">
								<if condition="$company.pro gt 0">
								<option value="{$company.pro}" selected>{$company.pro|getareaname}</option>
								<else />
								<option value="0" selected>省</option>
								</if>
								<volist name="pro" id="p">
								<option  value="{$p.area_id}">{$p.title}</option>
								</volist>
							</select>
							<select name="city" class="s-text-select city">
								<if condition="$company.city gt 0">
								<option value="{$company.city}" selected>{$company.city|getareaname}</option>
								<else />
								<option value="0" selected>市</option>
								</if>
							</select>
							<select name="area" class="s-text-select area">
								<if condition="$company.area gt 0">
								<option value="{$company.area}" selected>{$company.area|getareaname}</option>
								<else />
								<option value="0" selected>区</option>
								</if>
							</select>
							<input type="text" class="text address" name="address" value="{$company.address}" />
							<input type="hidden" name="map_x" id="map_x" value="{$company.map_x}" />
							<input type="hidden" name="map_y" id="map_y" value="{$company.map_y}" />
                            <a class="dingwei" href="javascript:">定位</a>
						</dd>
                        <dd><div style="width:603px;height:300px" id="container"></dd>
                        <dt>公司介绍<font color="red">*</font>：</dt>
                        <dd>
                        	<script id="intro" name="intro" type="text/plain" style="width:603px;height:300px;">{$company.intro}</script>
                        	<font color="red">公司介绍不能为空！</font>
						</dd>
                        <dd style="line-height:normal">
                     <button class="btn_prev_next" type="button">上一步</button>
                     <button class="btn_send"  type="submit">提交</button></dd>
                    </dl>
                    </form>
                </div>
<script>
	$(document).ready(function(){
		var ue = UE.getEditor('intro');
		$(".pro").change(function(){
			pro = $(this).val();
			$.post('__URL__/getarea',{type:'city',aid:pro},function(res){
				$(".city option").remove();
				$(".city").append("<option value='0'>市</option>");
				for(i=0;i<res.length;i++){
					$(".city").append("<option value='"+res[i]['area_id']+"'>"+res[i]['title']+"</option>");
				}
				//alert(res);
			},'json');
		});
		$(".city").change(function(){
			city = $(this).val();
			$.post('__URL__/getarea',{type:'area',aid:city},function(res){
				$(".area option").remove();
				$(".area").append("<option value='0'>区</option>");
				for(i=0;i<res.length;i++){
					$(".area").append("<option value='"+res[i]['area_id']+"'>"+res[i]['title']+"</option>");
				}
				//alert(res);
			},'json');
		});
		var center = new qq.maps.LatLng({$company.map_x},{$company.map_y});
		var map = new qq.maps.Map(document.getElementById("container"),{
			center: center,
			zoom: 13
		});
		var marker = new qq.maps.Marker({
			position: center,
			map: map
		});
		qq.maps.event.addListener(map, 'click', function(event) {
			$("#map_x").val(event.latLng.getLat());
			$("#map_y").val(event.latLng.getLng());
			marker.setPosition(new qq.maps.LatLng(event.latLng.getLat(),event.latLng.getLng()));
		});
		geocoder = new qq.maps.Geocoder({
			complete : function(result){
				$("#map_x").val(result.detail.location.getLat());
				$("#map_y").val(result.detail.location.getLng());
				map.setCenter(result.detail.location);
				marker.setPosition(result.detail.location);
			}
		});
		$(".dingwei").click(function(){
			pro = $('.pro').find('option:selected').text();
			city = $('.city').find('option:selected').text();
			area = $('.area').find('option:selected').text();
			address = $('.address').val();
			geocoder.getLocation(pro+city+area+address);			
		});
	});
</script>
                <!-- GS_Introduction结束 -->
<include file="Public:bottom" />
